<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>

  <style>
    .box {
      width: 300px;
      height: 500px;
      margin: 0 auto;
      background-color: green;
      /*开启flex布局*/
      display: flex;
    }

    .item {
      width: 150px;
      height: 100px;
      color: #fff;
      text-align: center;
      line-height: 100px;
    }

    .item1 {
      background-color: #f00;
      /*flex-shrink决定了flex item如何收缩*/
      /*可以设置任意非负数字(正小数、正整数、0), 默认是1*/
      /*当flex item在main axis方向上超过flex container的size时, flex-shrink才有效, flex item收缩后的最终size不能小于min-width/min-height*/
      /*如果所有flex item的flex-shrink总和sum大于1, 每个flex item收缩的size为flex item超出flex container的size*(flex-shrink/sum)*/
      /*如果所有flex item的flex-shrink总和不超过1, 每个flex item收缩的size为flex item超出flex container的size*flex-shrink*/
      flex-shrink: 2;
    }

    .item2 {
      background-color: #0f0;
      flex-shrink: 2;
    }

    .item3 {
      background-color: #00f;
      flex-shrink: 1;
    }
  </style>
</head>
<body>
<div class="box">
  <div class="item item1">item1</div>
  <div class="item item2">item2</div>
  <div class="item item3">item3</div>
</div>
</body>
</html>